﻿<UserControl x:Class="ModernUILogViewer.Content.ContentStatistics"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:chartingprimitive="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
             xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
             xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
             xmlns:conv="clr-namespace:ModernUILogViewer.Converters"
             xmlns:settings="clr-namespace:ModernUILogViewer.Settings"
             mc:Ignorable="d"              
             d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.Resources>

        <!--<conv:ColorConverter x:Key="colorconverter" />

        <SolidColorBrush x:Key="color1" Color="{Binding Source={StaticResource colorsettings}, Path=NoneColor, Converter={StaticResource colorconverter}, ConverterParameter={StaticResource NONE_COLOR} }" />
        <SolidColorBrush x:Key="color2" Color="{Binding Source={StaticResource colorsettings}, Path=DebugColor, Converter={StaticResource colorconverter}, ConverterParameter={StaticResource DEBUG_COLOR} }" />
        <SolidColorBrush x:Key="color3" Color="{Binding Source={StaticResource colorsettings}, Path=InfoColor, Converter={StaticResource colorconverter}, ConverterParameter={StaticResource INFO_COLOR} }" />
        <SolidColorBrush x:Key="color4" Color="{Binding Source={StaticResource colorsettings}, Path=WarnColor, Converter={StaticResource colorconverter}, ConverterParameter={StaticResource WARN_COLOR} }" />
        <SolidColorBrush x:Key="color5" Color="{Binding Source={StaticResource colorsettings}, Path=ErrorColor, Converter={StaticResource colorconverter}, ConverterParameter={StaticResource ERROR_COLOR} }" />
        <SolidColorBrush x:Key="color6" Color="{Binding Source={StaticResource colorsettings}, Path=FatalColor, Converter={StaticResource colorconverter}, ConverterParameter={StaticResource FATAL_COLOR} }" />-->

        <datavis:ResourceDictionaryCollection x:Key="userPalette">
            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="Control" >
                    <Setter Property="Background" Value="{Binding Source={StaticResource colorsettings}, Path=NoneColor, TargetNullValue={StaticResource NONE_COLOR}}"/>
                </Style>
            </ResourceDictionary>

            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="Control" >
                    <Setter Property="Background" Value="{Binding Source={StaticResource colorsettings}, Path=DebugColor, TargetNullValue={StaticResource DEBUG_COLOR}}" />
                </Style>
            </ResourceDictionary>

            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="Control" >
                    <Setter Property="Background" Value="{Binding Source={StaticResource colorsettings}, Path=InfoColor, TargetNullValue={StaticResource INFO_COLOR}}" />
                </Style>
            </ResourceDictionary>

            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="Control" >
                    <Setter Property="Background" Value="{Binding Source={StaticResource colorsettings}, Path=WarnColor, TargetNullValue={StaticResource WARN_COLOR}}" />
                </Style>
            </ResourceDictionary>

            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="Control" >
                    <Setter Property="Background" Value="{Binding Source={StaticResource colorsettings}, Path=ErrorColor, TargetNullValue={StaticResource ERROR_COLOR}}" />
                </Style>
            </ResourceDictionary>

            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="Control" >
                    <Setter Property="Background" Value="{Binding Source={StaticResource colorsettings}, Path=FatalColor, TargetNullValue={StaticResource FATAL_COLOR}}" />
                </Style>
            </ResourceDictionary>
        </datavis:ResourceDictionaryCollection>

    </UserControl.Resources>

    <ScrollViewer>
        <!--<Grid>-->
            
            <!--<Canvas Width="300" Height="300">
                <Canvas.Background>
                    <VisualBrush Visual="{Binding RelativeSource={RelativeSource AncestorType={x:Type charting:LegendItem}}}" />
                </Canvas.Background>
            </Canvas>-->
            
            <Grid>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <DockPanel Margin="{StaticResource DefaultRightMargin}">
                    <!--<TextBlock Style="{StaticResource Fixed}" 
                       HorizontalAlignment="Center"
                       DockPanel.Dock="Top">No filter</TextBlock>-->
                    <charting:Chart                     
                    Template="{StaticResource Template2}"
                    TitleStyle="{StaticResource TitleStyle2}"
                    LegendStyle="{StaticResource LegendStyle2}"                    
                Title="NO FILTER"
                Palette="{StaticResource userPalette}">
                        <charting:PieSeries                        
                         LegendItemStyle="{StaticResource LegendItemStyle2}"
                         DependentValueBinding="{Binding Value}"
                         IndependentValueBinding="{Binding Key}"
                         ItemsSource="{Binding AllEntriesKV}"                            
                    />
                    </charting:Chart>
                </DockPanel>

                <DockPanel Grid.Column="1" Margin="{StaticResource DefaultLeftMargin}">
                    <!--<TextBlock Style="{StaticResource Fixed}" 
                       HorizontalAlignment="Center"
                       DockPanel.Dock="Top">With filter</TextBlock>-->
                    <charting:Chart        
                    Template="{StaticResource Template2}"
                    TitleStyle="{StaticResource TitleStyle2}"
                    Title="WITH FILTER"
                    Palette="{StaticResource userPalette}"
                    LegendStyle="{StaticResource LegendStyle2}"
                    >
                        <charting:PieSeries                             
                            DependentValueBinding="{Binding Value}"
                            IndependentValueBinding="{Binding Key}"
                            ItemsSource="{Binding FilteredEntriesKV}"
                            LegendItemStyle="{StaticResource LegendItemStyle2}"
                />
                    </charting:Chart>
                </DockPanel>

            </Grid>
        <!--</Grid>-->
        
    </ScrollViewer>
</UserControl>
